﻿@using Kugar.Core.ExtMethod
@using Kugar.UI.Web.AdminLTE
@using Kugar.UI.Web.AdminLTE.Interfaces

@inject AdminLTEUI WebUI

@{
    Layout = null;

    ViewContext.ViewData["IsInPage"] = true;

    var title = (string) ViewBag.TabPageTitle;

    if (string.IsNullOrEmpty(title))
    {
        title = (string) ViewBag.Title;
    }

    var validator = (IClientValidateRender) this.ViewContext.HttpContext.RequestServices.GetService(typeof(IClientValidateRender));
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>@title</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    
    <link href="https://fonts.loli.net/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic" rel="stylesheet" />


    <link href="@(AdminLTEUI.LayoutPath.ResourceBaseUrl)/Content/css/adminbase_base_require.min.css" rel="stylesheet" />

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="@(AdminLTEUI.LayoutPath.ResourceBaseUrl)/Content/lib/html5shiv/html5.min.js"></script>
        <script src="@(AdminLTEUI.LayoutPath.ResourceBaseUrl)/Content/lib/respond/respond.min.js"></script>
    <![endif]-->
    <!-- Google Font -->

    @{
        var validatorCssFiles = validator?.CssFilesUrl();
    }

    @if (validatorCssFiles.HasData())
    {
        foreach (var cssFile in validatorCssFiles)
        {
            <link href="@cssFile" rel="stylesheet">
        }
    }
    
            <link href="@(AdminLTEUI.LayoutPath.ResourceBaseUrl)/Content/lib/webui_ctrl/all_plugins.min.css?v=@(AdminLTEUI.InternalFileMD5.webui_ctrl_all_plugins_css)" rel="stylesheet" asp-append-version="true" />

    <link href="@(AdminLTEUI.LayoutPath.ResourceBaseUrl)/Content/css/AdminLTEUICSS.css?v=@(AdminLTEUI.InternalFileMD5.AdminLTEUICSS_css)" rel="stylesheet" asp-append-version="true" />

    <link href="@(AdminLTEUI.LayoutPath.ResourceBaseUrl)/Content/css/AdminLTEUICSS.inner.css?v=@(AdminLTEUI.InternalFileMD5.AdminLTEUICSS_inner_css)" rel="stylesheet" asp-append-version="true" />

    @RenderSection("styles", false)
</head>
<body class="hold-transition skin-blue sidebar-mini iframecontent">
    <!-- Site wrapper -->
    <div class="wrapper">

        <!-- Content Wrapper. Contains page content -->
        <div class="content-wrapper" id="content-wrapper" style="min-height: 421px;">

            <section class="content-header">
                <h1 class="title">
                    @WebUI.Title
                    <small>@WebUI.Subtitle</small>
                </h1>

                @if (WebUI.Breadcrumbs.HasData())
                {
                    <ol class="breadcrumb">
                        @for (int i = 0; i < WebUI.Breadcrumbs.Length; i++)
                        {
                            var item = WebUI.Breadcrumbs[i];

                            <li class="@((i == WebUI.Breadcrumbs.Length - 1) ? "active" : "")">
                                <a href="@item.Href.IfEmptyOrWhileSpace("#")">
                                    @if (i == 0)
                                    {
                                        <i class="fa fa-dashboard"></i>
                                    }
                                    @item.Title
                                </a>
                            </li>
                        }
                    </ol>
                }


            </section>
            <!-- Main content -->
            <section class="content">
                @RenderBody()
                <div class="clearfix"></div>
            </section>
            <!-- Content Header (Page header) -->
            <!-- /.content -->

            <div class="clearfix"></div>
        </div>
        <!-- /.content-wrapper -->

    </div>
    <!-- ./wrapper -->
    
<script src="@(AdminLTEUI.LayoutPath.ResourceBaseUrl)/Content/js/adminbase_base_require.min.js"></script>
<script src="@(AdminLTEUI.LayoutPath.ResourceBaseUrl)/Content/lib/layui/layui.js"></script>

@{
        var validatorScripts = validator?.Scripts().ToArrayEx();
    }
    @if (validatorScripts.HasData())
    {
        foreach (var url in validatorScripts)
        {
            <script src="@url"></script>
        }
    }
    
    <script src="@(AdminLTEUI.LayoutPath.ResourceBaseUrl)/Content/lib/webui_ctrl/all_plugins.js?v=@(AdminLTEUI.InternalFileMD5.webui_ctrl_all_plugins_js)" asp-append-version="true"></script>

    <script src="@(AdminLTEUI.LayoutPath.ResourceBaseUrl)/Content/js/WebUIJS.js?v=@(AdminLTEUI.InternalFileMD5.WebUIJS_js)" asp-append-version="true"></script>

    <script src="@(AdminLTEUI.LayoutPath.ResourceBaseUrl)/Content/js/WebUIJS.inner.js?v=@(AdminLTEUI.InternalFileMD5.WebUIJS_inner_js)" asp-append-version="true"></script>


    <script>
    @{
        validator?.Render(ViewContext);
    }
    </script>

    <script>
    //layui.use('layer',
    //    function() {
    //        layer = layui.layer;
    //        //layui.layer.load();
    //    });

    WebUIJS.ResourceUrl = "@AdminLTEUI.LayoutPath.ResourceBaseUrl";
    var currentMenuKey = '@WebUI.CurrentMenuKey';

    $(document).ready(function() {

        layui.use(['layer'],
            function() {
                layer = layui.layer;
                layui.layer.load();

                WebUIJS.RefreshEvent($("body"),
                    function() {
                        layui.use('layer',
                            function() {
                                layui.layer.closeAll('loading'); //关闭加载层
                            });

                        WebUIJS.SetActiveMenuKey(currentMenuKey);
                    });
            });


    });
    </script>

    @RenderSection("scripts", false)

    @WebUI.SystemComponent.ServerMsg().Render()

</body>
</html>